package com.example.demo.advice;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.io.IOException;
//利用advice进行全局异常处理
@RestControllerAdvice
public class ExAdvice {
    @ExceptionHandler
    public String process(IOException ex) {
        return ex.getMessage();
    }
}
